home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 65.zip / BS1 part 65 / Math Visin v2.1 disk 1.adf / Arexx.WB / Sequence < prev    next >
Text File  |  1992-02-12  |  2KB  |  51 lines

  1. /* Sequence.  A generic ARexx macro to run a series of ARexx macros   8-Mar-90 dh
  2.  
  3.   Click once on this program, hold down the shift key, click on the desired
  4. macros to run, and double-click on the last one.
  5.  
  6.   This macro was designed for sequencing convolutions, but may be used
  7. for other processes as well.  Note that all the arguments should be complete
  8. filenames, starting with a volume.
  9.  
  10. ---------------------------------------------------------------------------- */
  11.  
  12. OPTIONS RESULTS
  13. OPTIONS FAILAT 1
  14. SIGNAL ON ERROR
  15. NUMERIC DIGITS 14
  16.  
  17. PARSE ARG CommandLine    /* break command line into filename array */
  18. Delim = d2c(10)
  19. TotalFilenames = 0
  20. DO FOREVER
  21.   position = POS(Delim,CommandLine||Delim)
  22.   IF (position<2) THEN LEAVE
  23.   TotalFilenames = TotalFilenames+1
  24.   Filename.TotalFilenames = Left(CommandLine,position-1)
  25.   CommandLine = SubStr(CommandLine,position+1)
  26. END
  27.  
  28. DO i = 1 to TotalFileNames /* run each macro in turn */
  29.   SAY Filename.i
  30.   CALL SeparateFilename( Filename.i )
  31.   PARSE VAR RESULT Filename Path .
  32.   OldDir = PRAGMA( 'Directory', Path )
  33.     INTERPRET CALL Filename
  34. END 
  35.  
  36. EXIT
  37.  
  38. /*---------------------------- SeparateFilename -------------------------- */
  39. /* given a complete path and filename, return filename and path separately. */
  40.  
  41. SeparateFilename: PROCEDURE
  42.   ARG allpath
  43.   T = LASTPOS("/",AllPath)
  44.   IF (T~=0) THEN DO; RETURN SubStr(AllPath, T+1) LEFT(AllPath, T-1); END 
  45.   ELSE
  46.   DO
  47.     T = Index(AllPath, ":")
  48.     IF (T~=0) THEN DO; RETURN SubStr(AllPath,T+1) LEFT(AllPath,T); END
  49.     ELSE RETURN AllPath
  50.   END
  51.